<?php defined('SYSPATH') or die('No direct script access.'); ?>
<style type="text/css">
    table.userlist {
        margin: 20px auto;
        width: 100%;
        text-align: left;
        border-collapse: collapse;
    }
    .userlist .main td {
        background-color: #555555;
        color: #ffffff;
        padding: 5px 10px;
        font-weight: normal;
    }
    .userlist td {
        color: #666666;
        padding: 5px 10px;
    }
    .userlist a {
        color: #666666;
        font-weight: bold;
    }
    /* Sortable tables */
    table.sortable thead {
        background-color:#eee;
        color:#666666;
        font-weight: bold;
        cursor: default;
    }
</style>
<?php if($error): ?>  
<script>alert("<?php echo $error;?>");</script>
<?php endif;?>
<?php if($items !== NULL && count($items) > 2): //$items can be array('purchaseURL' => '') ?>
<h1 style="text-align: center">My cart</h1>
<table class="userlist" style="width:96%">
    <tr class="main">
        <td> &nbsp; <!-- image --></td>
        <td>Title</td>     
        <td>Price</td>
        <td>Quantity</td>
        <td>Remove</td>
    </tr>
<?php
foreach ($items as $i => $it)
    if(is_array($it))
        echo '<tr><td><img alt="(no image)" src="', $it['src'] ,'"/></td>
            <td style="width:50%;"><a href="/shop/product/', $it['ASIN'], 
            '">', $it['Title'], '</a></td>
            <td>', $it['Price'], '</td>
            <td style="text-align:center">  ', $it['Quantity'],
            '</td>
             <td><form action="cart" method="post">
             <input type="image" src="/images/button_delete_blue.png">
             <input type="hidden" name="remove" value="',$it['ASIN'],'"></form>
             </td>   
                </tr>';

?>
    <tr>
        <td style="text-align:center; " colspan="4">
            Total <?php echo $items['Total'];?>
        </td>
    </tr>
    <tr>
        <td style="text-align:center; " colspan="4">
            <form action="/shop/payment" method="post" id="payment">
                <a href="javascript:void(0);" onclick="$('#payment').submit();return false;" title="proceed to checkout">
                    <img src="/images/proceed_to_checkout.jpg" alt="proceed to checkout" title="proceed to checkout"/>
                </a>
                <input type="hidden" name="url" value="<?php echo $items['purchaseURL'];?>">
            </form>
        </td>
    </tr>
</table>

<?php else: ?>
    <br /><br /><br />
    <center>There is no items in your cart</center>
    <br /><br />
<?php endif;
